/*
Replication code for:
"Does Social Desirability Bias Distort Survey Analyses of Ideology and Self-Interest? Evidence from a List Experiment on Progressive Taxation"

Author: Tobias Heide-Jørgensen.

Purpose: Reproducing main results.

Required Stata packages: mylabels (ssc install mylabels), estout (ssc install estout), coefplot (ssc install coefplot), and mimrgns (ssc install mimrgns).
*/

***MAIN ANALYSES***

*Read data
use "main_data.dta",clear

*Table 1
foreach var of varlist gender age region edu_short {
tab `var' treat
}

foreach var of varlist gender age region edu_short {
tab `var', gen(`var')
}

foreach var of varlist gender1 gender2 age1 age2 age3 age4 region1 region2 region3 region4 region5 edu_short1 edu_short2 edu_short3 {
prtest `var', by(treat)
}

*Figure 1
preserve

eststo prog_dir: reg prog_dir,robust

qui reg no_items treat,robust
eststo prog_indir: margins, dydx(treat) post	

reg no_items_total treat,robust

gen overall_lab="26%" if treat==0
replace overall_lab="20%" if treat==1

bysort treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_dir, label(Direct question) color(gs4) lcolor(%0))(prog_indir, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(1) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xlabel(,nolabels notick) yscale(titlegap(5)) xscale(r(-.5 3.5)) fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(overall_lab) mlabsize(med) mlabpos(2) mlabcolor(black))
			
restore

*Figure 2
preserve

qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban,robust
eststo prog_inc_dir: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo prog_inc_indir: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(h_inc=(1 2 3)) 

gen inc_lab="22%" if h_inc==1 & treat==0
replace inc_lab="4%" if h_inc==1 & treat==1
replace inc_lab="23%" if h_inc==2 & treat==0
replace inc_lab="27%" if h_inc==2 & treat==1
replace inc_lab="34%" if h_inc==3 & treat==0
replace inc_lab="41%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure 3
preserve

qui reg prog_dir i.ideo_group i.gender i.age i.region i.edu i.h_inc_full i.occu i.urban,robust
eststo prog_ideo_dir: margins, at(ideo_group=(1 2 3)) post	

qui reg no_items treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
eststo prog_ideo_indir: margins, dydx(treat) at(ideo_group=(1 2 3)) post	

qui reg no_items_total treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(ideo_group=(1 2 3)) 

gen ideo_lab="14%" if ideo_group==1 & treat==0
replace ideo_lab="24%" if ideo_group==1 & treat==1
replace ideo_lab="24%" if ideo_group==2 & treat==0
replace ideo_lab="15%" if ideo_group==2 & treat==1
replace ideo_lab="42%" if ideo_group==3 & treat==0
replace ideo_lab="18%" if ideo_group==3 & treat==1

bysort ideo_group treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med))  xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

***SUPPLEMENTARY MATERIAL***

*Table C.1
tab no_items treat, col

*Table D.1
kict deff no_items, nnonkey(4) condition(treat)

*Table E.1
eststo m1: reg prog_dir,robust

eststo m2: reg no_items treat,robust

eststo m3: reg no_items_total treat,robust
				
esttab m1 m2 m3, b(2) p(3) r2(2) nostar wide mgroups("Direct question" "No. list items" "Total no. items", numbers pattern(1 0 0 0) span erepeat(\cmidrule(lr){@span})) varwidth(25) style(tex) label replace

*Table E.2-3
eststo m1: qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban,robust
reg prog_dir ib(2).h_inc i.gender i.age i.region i.edu i.occu i.urban,robust 
eststo margins_1: margins, at(h_inc=(1 2 3)) post

eststo m2: reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
reg no_items treat##ib(2).h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo margins_2: margins, dydx(treat) at(h_inc=(1 2 3)) post

eststo m3: reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
reg no_items_total treat##ib(2).h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo margins_3: margins, dydx(treat) at(h_inc=(1 2 3)) post

esttab m1 m2 m3, b(2) p(3) r2(2) nostar wide mgroups("Direct question" "No. list items" "Total no. items", numbers pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) label replace keep(2.h_inc 3.h_inc 1.treat 1.treat#2.h_inc 1.treat#3.h_inc 2.gender 1.treat#2.gender 2.age 3.age 4.age 1.treat#2.age 1.treat#3.age 1.treat#4.age 2.region 3.region 4.region 5.region 1.treat#2.region 1.treat#3.region 1.treat#4.region 1.treat#5.region 2.urban 3.urban 4.urban 5.urban 6.urban 1.treat#2.urban 1.treat#3.urban 1.treat#4.urban 1.treat#5.urban 1.treat#6.urban 2.edu 3.edu 4.edu 5.edu 6.edu 7.edu 8.edu 1.treat#2.edu 1.treat#3.edu 1.treat#4.edu 1.treat#5.edu 1.treat#6.edu 1.treat#7.edu 1.treat#8.edu 2.occu 3.occu 4.occu 5.occu 6.occu 7.occu 8.occu 1.treat#2.occu 1.treat#3.occu 1.treat#4.occu 1.treat#5.occu 1.treat#6.occu 1.treat#7.occu 1.treat#8.occu _cons) order(2.h_inc 3.h_inc 1.treat 1.treat#2.h_inc 1.treat#3.h_inc 2.gender 1.treat#2.gender 2.age 3.age 4.age 1.treat#2.age 1.treat#3.age 1.treat#4.age 2.region 3.region 4.region 5.region 1.treat#2.region 1.treat#3.region 1.treat#4.region 1.treat#5.region 2.urban 3.urban 4.urban 5.urban 6.urban 1.treat#2.urban 1.treat#3.urban 1.treat#4.urban 1.treat#5.urban 1.treat#6.urban 2.edu 3.edu 4.edu 5.edu 6.edu 7.edu 8.edu 1.treat#2.edu 1.treat#3.edu 1.treat#4.edu 1.treat#5.edu 1.treat#6.edu 1.treat#7.edu 1.treat#8.edu 2.occu 3.occu 4.occu 5.occu 6.occu 7.occu 8.occu 1.treat#2.occu 1.treat#3.occu 1.treat#4.occu 1.treat#5.occu 1.treat#6.occu 1.treat#7.occu 1.treat#8.occu _cons)

esttab margins_1 margins_2 margins_3, b(2) p(3) r2(2) nostar wide  label 

*Table E.4-5
eststo m1: qui reg prog_dir i.ideo_group i.gender i.age i.region i.edu i.h_inc_full i.occu i.urban,robust
eststo margins_1: qui margins, at(ideo_group=(1 2 3)) post

eststo m2: qui reg no_items treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
eststo margins_2: qui margins, dydx(treat) at(ideo_group=(1 2 3)) post

eststo m3: qui reg no_items_total treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
eststo margins_3: qui margins, dydx(treat) at(ideo_group=(1 2 3))  post

esttab m1 m2 m3, b(2) p(3) r2(2) nostar wide mgroups("Direct question" "No. list items" "Total no. items", numbers pattern(1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) label replace keep(2.ideo_group 3.ideo_group 1.treat 1.treat#2.ideo_group 1.treat#3.ideo_group 2.gender 1.treat#2.gender 2.age 3.age 4.age 1.treat#2.age 1.treat#3.age 1.treat#4.age 2.region 3.region 4.region 5.region 1.treat#2.region 1.treat#3.region 1.treat#4.region 1.treat#5.region 2.urban 3.urban 4.urban 5.urban 6.urban 1.treat#2.urban 1.treat#3.urban 1.treat#4.urban 1.treat#5.urban 1.treat#6.urban 2.edu 3.edu 4.edu 5.edu 6.edu 7.edu 8.edu 1.treat#2.edu 1.treat#3.edu 1.treat#4.edu 1.treat#5.edu 1.treat#6.edu 1.treat#7.edu 1.treat#8.edu 2.h_inc_full 3.h_inc_full 4.h_inc_full 5.h_inc_full 6.h_inc_full 7.h_inc_full 8.h_inc_full 9.h_inc_full 10.h_inc_full 11.h_inc_full 12.h_inc_full 13.h_inc_full 1.treat#2.h_inc_full 1.treat#3.h_inc_full 1.treat#4.h_inc_full 1.treat#5.h_inc_full 1.treat#6.h_inc_full 1.treat#7.h_inc_full 1.treat#8.h_inc_full 1.treat#9.h_inc_full 1.treat#10.h_inc_full 1.treat#11.h_inc_full 1.treat#12.h_inc_full 1.treat#13.h_inc_full 2.occu 3.occu 4.occu 5.occu 6.occu 7.occu 8.occu 1.treat#2.occu 1.treat#3.occu 1.treat#4.occu 1.treat#5.occu 1.treat#6.occu 1.treat#7.occu 1.treat#8.occu _cons) order(2.ideo_group 3.ideo_group 1.treat 1.treat#2.ideo_group 1.treat#3.ideo_group 2.gender 1.treat#2.gender 2.age 3.age 4.age 1.treat#2.age 1.treat#3.age 1.treat#4.age 2.region 3.region 4.region 5.region 1.treat#2.region 1.treat#3.region 1.treat#4.region 1.treat#5.region 2.urban 3.urban 4.urban 5.urban 6.urban 1.treat#2.urban 1.treat#3.urban 1.treat#4.urban 1.treat#5.urban 1.treat#6.urban 2.edu 3.edu 4.edu 5.edu 6.edu 7.edu 8.edu 1.treat#2.edu 1.treat#3.edu 1.treat#4.edu 1.treat#5.edu 1.treat#6.edu 1.treat#7.edu 1.treat#8.edu 2.h_inc_full 3.h_inc_full 4.h_inc_full 5.h_inc_full 6.h_inc_full 7.h_inc_full 8.h_inc_full 9.h_inc_full 10.h_inc_full 11.h_inc_full 12.h_inc_full 13.h_inc_full 1.treat#2.h_inc_full 1.treat#3.h_inc_full 1.treat#4.h_inc_full 1.treat#5.h_inc_full 1.treat#6.h_inc_full 1.treat#7.h_inc_full 1.treat#8.h_inc_full 1.treat#9.h_inc_full 1.treat#10.h_inc_full 1.treat#11.h_inc_full 1.treat#12.h_inc_full 1.treat#13.h_inc_full 2.occu 3.occu 4.occu 5.occu 6.occu 7.occu 8.occu 1.treat#2.occu 1.treat#3.occu 1.treat#4.occu 1.treat#5.occu 1.treat#6.occu 1.treat#7.occu 1.treat#8.occu _cons)

esttab margins_1 margins_2 margins_3, b(2) p(3) r2(2) nostar wide  label 

*Figure F.1
preserve

reg prog_dir [pw=weight],robust
eststo prog_dir_w

qui reg no_items treat [pw=weight],robust
eststo prog_indir_w: margins, dydx(treat) post	

reg no_items_total treat [pw=weight],robust

gen overall_lab="26%" if treat==0
replace overall_lab="20%" if treat==1

bysort treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_dir_w, label(Direct question) color(gs4) lcolor(%0))(prog_indir_w, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(1) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med))  yscale(titlegap(5)) xlabel(,nolabels notick) xscale(r(-.5 3.5)) fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(overall_lab) mlabsize(med) mlabpos(2) mlabcolor(black))
		
restore

*Figure F.2
preserve

qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban [pw=weight],robust
eststo prog_inc_dir_w: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban [pw=weight],robust
eststo prog_inc_indir_w: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban [pw=weight],robust
margins, dydx(treat) at(h_inc=(1 2 3))

gen inc_lab="22%" if h_inc==1 & treat==0
replace inc_lab="5%" if h_inc==1 & treat==1
replace inc_lab="23%" if h_inc==2 & treat==0
replace inc_lab="27%" if h_inc==2 & treat==1
replace inc_lab="35%" if h_inc==3 & treat==0
replace inc_lab="40%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_w, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_w, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure F.3
preserve

qui reg prog_dir i.ideo_group i.gender i.age i.region i.edu i.h_inc_full i.occu i.urban [pw=weight],robust
eststo prog_ideo_dir_w: margins, at(ideo_group=(1 2 3)) post	

qui reg no_items treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban [pw=weight],robust
eststo prog_ideo_indir_w: margins, dydx(treat) at(ideo_group=(1 2 3)) post	

qui reg no_items_total treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban [pw=weight],robust
margins, dydx(treat) at(ideo_group=(1 2 3))

gen ideo_lab="13%" if ideo_group==1 & treat==0
replace ideo_lab="25%" if ideo_group==1 & treat==1
replace ideo_lab="24%" if ideo_group==2 & treat==0
replace ideo_lab="16%" if ideo_group==2 & treat==1
replace ideo_lab="42%" if ideo_group==3 & treat==0
replace ideo_lab="18%" if ideo_group==3 & treat==1

bysort ideo_group treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir_w, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir_w, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure G.1
recode ideo (6 7 =.),gen(ideo_new)
recode h_inc_full (12 13 =.),gen(h_inc_new)

mi set flong							
							
mi register imputed ideo_new h_inc_new		
mi register regular	treat no_items no_items_total gender age region edu occu urban

mi impute chained (ologit) ideo_new h_inc_new = treat no_items no_items_total gender age region edu occu urban, add(25) rseed(1234) augment

mi passive: gen ideo_group_mi=1 if inlist(ideo_new,4,5)
mi passive: replace ideo_group_mi=2 if ideo_new == 3
mi passive: replace ideo_group_mi=3 if inlist(ideo_new,1,2)

mi passive: gen h_inc_mi=1 if inrange(h_inc_new,1,4)
mi passive: replace h_inc_mi=2 if inrange(h_inc_new,5,7)
mi passive: replace h_inc_mi=3 if inrange(h_inc_new,8,11)

preserve

qui mi estimate, saving(miestfile,replace) esample(esample): reg prog_dir i.h_inc_mi i.gender i.age i.region i.edu i.occu i.urban,robust
eststo prog_inc_dir_imp: mimrgns using miestfile, esample(esample) at(h_inc_mi=(1 2 3))  cmdmargins post

drop esample

qui mi estimate, saving(miestfile,replace) esample(esample): reg no_items treat##h_inc_mi treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo prog_inc_indir_imp: mimrgns using miestfile, esample(esample) dydx(treat) at(h_inc_mi=(1 2 3)) post

drop esample

qui mi estimate, saving(miestfile,replace) esample(esample): reg no_items_total treat##h_inc_mi treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
mimrgns using miestfile, esample(esample) dydx(treat) at(h_inc_mi=(1 2 3)) post

drop esample

gen inc_lab="22%" if h_inc_mi==1 & treat==0
replace inc_lab="8%" if h_inc_mi==1 & treat==1
replace inc_lab="24%" if h_inc_mi==2 & treat==0
replace inc_lab="25%" if h_inc_mi==2 & treat==1
replace inc_lab="35%" if h_inc_mi==3 & treat==0
replace inc_lab="38%" if h_inc_mi==3 & treat==1

bysort h_inc_mi treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_imp, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_imp, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure G.2
qui mi estimate, saving(miestfile,replace) esample(esample): reg prog_dir i.ideo_group_mi i.gender i.age i.region i.edu i.h_inc_new i.occu i.urban,robust
eststo prog_ideo_dir_imp: mimrgns using miestfile, esample(esample) at(ideo_group_mi=(1 2 3)) cmdmargins post

drop esample

qui mi estimate, saving(miestfile,replace) esample(esample): reg no_items treat##ideo_group_mi treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_new treat##i.occu treat##i.urban,robust
eststo prog_ideo_indir_imp: mimrgns using miestfile, esample(esample) dydx(treat) at(ideo_group_mi=(1 2 3)) cmdmargins post

drop esample

qui mi estimate, saving(miestfile,replace) esample(esample): reg no_items_total treat##ideo_group_mi treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_new treat##i.occu treat##i.urban,robust
mimrgns using miestfile, esample(esample) dydx(treat) at(ideo_group_mi=(1 2 3)) cmdmargins post

drop esample

gen ideo_lab="13%" if ideo_group_mi==1 & treat==0
replace ideo_lab="24%" if ideo_group_mi==1 & treat==1
replace ideo_lab="23%" if ideo_group_mi==2 & treat==0
replace ideo_lab="16%" if ideo_group_mi==2 & treat==1
replace ideo_lab="41%" if ideo_group_mi==3 & treat==0
replace ideo_lab="20%" if ideo_group_mi==3 & treat==1

bysort ideo_group_mi treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir_imp, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir_imp, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

*Reload main data
use "main_data.dta",clear

*Figure H.1
preserve

qui reg prog_dir i.h_inc,robust
eststo prog_inc_dir_nocov: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc,robust
eststo prog_inc_indir_nocov: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc,robust
margins, dydx(treat) at(h_inc=(1 2 3))

gen inc_lab="21%" if h_inc==1 & treat==0
replace inc_lab="7%" if h_inc==1 & treat==1
replace inc_lab="23%" if h_inc==2 & treat==0
replace inc_lab="26%" if h_inc==2 & treat==1
replace inc_lab="36%" if h_inc==3 & treat==0
replace inc_lab="38%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_nocov, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_nocov, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore		

*Figure H.2
preserve

qui reg prog_dir i.ideo_group,robust
eststo prog_ideo_dir_nocov: margins, at(ideo_group=(1 2 3)) post	

qui reg no_items treat##ideo_group,robust
eststo prog_ideo_indir_nocov: margins, dydx(treat) at(ideo_group=(1 2 3)) post	

qui reg no_items_total treat##ideo_group,robust
margins, dydx(treat) at(ideo_group=(1 2 3))

gen ideo_lab="12%" if ideo_group==1 & treat==0
replace ideo_lab="22%" if ideo_group==1 & treat==1
replace ideo_lab="25%" if ideo_group==2 & treat==0
replace ideo_lab="17%" if ideo_group==2 & treat==1
replace ideo_lab="43%" if ideo_group==3 & treat==0
replace ideo_lab="20%" if ideo_group==3 & treat==1

bysort ideo_group treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir_nocov, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir_nocov, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure I.1
preserve

qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban i.ideo_group,robust
eststo prog_inc_dir_conideo: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban treat##ideo_group,robust
eststo prog_inc_indir_conideo: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban treat##ideo_group,robust
margins, dydx(treat) at(h_inc=(1 2 3)) 

gen inc_lab="24%" if h_inc==1 & treat==0
replace inc_lab="-3%" if h_inc==1 & treat==1
replace inc_lab="24%" if h_inc==2 & treat==0
replace inc_lab="31%" if h_inc==2 & treat==1
replace inc_lab="32%" if h_inc==3 & treat==0
replace inc_lab="46%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_conideo, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_conideo, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure J.1
preserve

keep if edu>4 

eststo prog_dir_edu: reg prog_dir,robust

qui reg no_items treat,robust
eststo prog_indir_edu: margins, dydx(treat) post	

reg no_items_total treat,robust

gen overall_lab="25%" if treat==0
replace overall_lab="20%" if treat==1

bysort treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_dir_edu, label(Direct question) color(gs4) lcolor(%0))(prog_indir_edu, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(1) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med))  yscale(titlegap(5)) xlabel(,nolabels notick) xscale(r(-.5 3.5)) fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(overall_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure J.2
preserve

keep if edu>4

qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban,robust
eststo prog_inc_dir_edu: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo prog_inc_indir_edu: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(h_inc=(1 2 3))

gen inc_lab="24%" if h_inc==1 & treat==0
replace inc_lab="-14%" if h_inc==1 & treat==1
replace inc_lab="23%" if h_inc==2 & treat==0
replace inc_lab="17%" if h_inc==2 & treat==1
replace inc_lab="30%" if h_inc==3 & treat==0
replace inc_lab="42%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_edu, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_edu, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med))xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure J.3
preserve

keep if edu>4

qui reg prog_dir i.ideo_group i.gender i.age i.region i.edu i.h_inc_full i.occu i.urban,robust
eststo prog_ideo_dir_edu: margins, at(ideo_group=(1 2 3)) post	

qui reg no_items treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
eststo prog_ideo_indir_edu: margins, dydx(treat) at(ideo_group=(1 2 3)) post	

qui reg no_items_total treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(ideo_group=(1 2 3))

gen ideo_lab="11%" if ideo_group==1 & treat==0
replace ideo_lab="13%" if ideo_group==1 & treat==1
replace ideo_lab="24%" if ideo_group==2 & treat==0
replace ideo_lab="11%" if ideo_group==2 & treat==1
replace ideo_lab="46%" if ideo_group==3 & treat==0
replace ideo_lab="14%" if ideo_group==3 & treat==1

bysort ideo_group treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir_edu, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir_edu, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure J.4
preserve

drop if time<15

eststo prog_dir_time: reg prog_dir,robust

qui reg no_items treat,robust
eststo prog_indir_time: margins, dydx(treat) post	

reg no_items_total treat,robust

gen overall_lab="25%" if treat==0
replace overall_lab="19%" if treat==1

bysort treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_dir_time, label(Direct question) color(gs4) lcolor(%0))(prog_indir_time, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(1) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) yscale(titlegap(5)) xlabel(,nolabels notick) xscale(r(-.5 3.5)) fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(overall_lab) mlabsize(med) mlabpos(2) mlabcolor(black))
			
restore

*Figure J.5
preserve

drop if time<15

qui reg prog_dir i.h_inc i.gender i.age i.region i.edu i.occu i.urban,robust
eststo prog_inc_dir_time: margins, at(h_inc=(1 2 3)) post	

qui reg no_items treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
eststo prog_inc_indir_time: margins, dydx(treat) at(h_inc=(1 2 3)) post

qui reg no_items_total treat##h_inc treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(h_inc=(1 2 3))

gen inc_lab="21%" if h_inc==1 & treat==0
replace inc_lab="8%" if h_inc==1 & treat==1
replace inc_lab="23%" if h_inc==2 & treat==0
replace inc_lab="22%" if h_inc==2 & treat==1
replace inc_lab="33%" if h_inc==3 & treat==0
replace inc_lab="36%" if h_inc==3 & treat==1

bysort h_inc treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_inc_dir_time, label(Direct question) color(gs4) lcolor(%0))(prog_inc_indir_time, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Income, size(med)) xlabel(1 "Low" 2 "Middle" 3 "High",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(inc_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore

*Figure J.6
preserve

drop if time<15

qui reg prog_dir i.ideo_group i.gender i.age i.region i.edu i.h_inc_full i.occu i.urban,robust
eststo prog_ideo_dir_time: margins, at(ideo_group=(1 2 3)) post	

qui reg no_items treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
eststo prog_ideo_indir_time: margins, dydx(treat) at(ideo_group=(1 2 3)) post	

qui reg no_items_total treat##ideo_group treat##i.gender treat##i.age treat##i.region treat##i.edu treat##i.h_inc_full treat##i.occu treat##i.urban,robust
margins, dydx(treat) at(ideo_group=(1 2 3))

gen ideo_lab="13%" if ideo_group==1 & treat==0
replace ideo_lab="21%" if ideo_group==1 & treat==1
replace ideo_lab="22%" if ideo_group==2 & treat==0
replace ideo_lab="13%" if ideo_group==2 & treat==1
replace ideo_lab="41%" if ideo_group==3 & treat==0
replace ideo_lab="20%" if ideo_group==3 & treat==1

bysort ideo_group treat: keep if _n==_N

mylabels 0(20)100, myscale(@/100) local(prog) suffix("%")
coefplot (prog_ideo_dir_time, label(Direct question) color(gs4) lcolor(%0))(prog_ideo_indir_time, label(List question) color(gs9) lcolor(%0)),vertical order(_cons treat) legend(pos(4) col(1) region(lstyle(none))  linegap(3) size(med) symxsize(*0.2)) recast(bar) barwidth(0.333) level(90) ciopts(recast(rcap) color(black) lwidth(0.2)) ylabel(`prog', angle(h) labsize(med)) xscale(titlegap(5))  yscale(titlegap(5)) xtitle(Ideology, size(med)) xlabel(1 "Leftists" 2 "Centrists" 3 "Rightists",labsize(med))  fcolor(*.8) citop scheme(s1mono) graphregion(color(white)) plotregion(lcolor(white) margin(b=0)) format(%9.2f) ytitle(Percent opposing progressive taxation,size(med)) addplot(scatter @b @at, ms(i) mlabel(ideo_lab) mlabsize(med) mlabpos(2) mlabcolor(black))

restore